ScanDeviceManager DeviceStatusChanged
The DeviceStatusChanged event notifies the host application when the Hardware Manager discovers a change in the device status. To query the status change use the GetDeviceStatusSnapshot() command and retrieve the StatusCategory flag to identify the status change in the device.
public event EventHandler<DeviceStatusChangedEventArgs> DeviceStatusChanged |
Example
Copy
private void Init()
{
scanDeviceManager = new ScanDeviceManager();
scanDeviceManager.DeviceStatusChanged += ScanDeviceManager_DeviceStatusChanged;
scanDeviceManager.EnabledStatusCategories |= DeviceStatusCategories.ConnectionStatus | DeviceStatusCategories.ScanningStatus | DeviceStatusCategories.LaserPositionStatus;
}
private void ScanDeviceManager_DeviceStatusChanged(object sender, DeviceStatusChangedEventArgs e)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new EventHandler<DeviceStatusChangedEventArgs>(ScanDeviceManager_DeviceStatusChanged), sender, e);
}
else
{
if (e.DeviceUniqueName == GetselectedDeviceUniqueName())
{
DeviceStatusSnapshot DevStatus = scanDeviceManager.GetDeviceStatusSnapshot(e.DeviceUniqueName);
DeviceStatusCategories statusCat = DevStatus.StatusCategory;
}
}
}